package vip.xiaonuo.smzq.modular.dictionary.mapper;

import org.apache.ibatis.annotations.Select;
import vip.xiaonuo.smzq.modular.dictionary.entity.Cb06Kc;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vip.xiaonuo.smzq.modular.dictionary.entity.vo.Cb06KcVo;

import java.util.List;

/**
 * 矿产 Mapper
 *
 * @author eomer
 * @since 2024-02-21
 */
@Mapper
public interface Cb06KcMapper extends BaseMapper<Cb06Kc> {
    /**
     * 矿产名称下拉框
     */
    @Select("select kcmc from kcl_cb06_kc where kclb=#{kclb} GROUP BY  kcmc")
    List<String> selectKcNames(String kclb);

    /**
     * 综合回收矿产名称查询
     */
    @Select("select t.*,\n" +
            "z.pkid as id,\n" +
            "z.mc,\n" +
            "CAST(z.dm as TEXT) as dm\n" +
            "from kcl_cb06_kc t\n" +
            "full outer join kcl_cb01_zh z on t.kclb = CAST(z.dm as TEXT)\n" +
            "where z.bh = 70 and z.bnm != 0 and z.dm is not null order by z.dm")
    List<Cb06KcVo> selectZhhsList();
}
